<?php if (!defined('BASEPATH')) exit('No direct access allowed.');

/**
 * 
 * @author xuelange
 *
 */
class Userlib
{
	private $_user = null;
	public $uid = 0;
	public $uemail = '';
	public $sid = 0;
	private $_CI;
	
	public function __construct()
	{
		/** 获取CI句柄 */
		$this->_CI = & get_instance();
	
		$this->_user = $this->_CI->session->userdata('__USER__');
		$sid = $this->_CI->session->userdata('session_id');
		
		/** 初始化工作 */
		if(!empty($this->_user))
		{
			$this->uid = $this->_user['id'];
			$this->uemail = $this->_user['email'];
			$this->sid = $sid;
		}
	
		log_message('debug', "User library Class Initialized");
	}
	
	
	public function get_session() {
		/** 获取CI句柄 */
		$this->_CI = & get_instance();
		
		$this->_user = $this->_CI->session->userdata('__USER__');
		$sid = $this->_CI->session->userdata('session_id');
		
		/** 初始化工作 */
		if(!empty($this->_user))
		{
			$this->uid = $this->_user['id'];
			$this->uemail = $this->_user['email'];
			$this->sid = $sid;
		}
	}
}